<?php 
if (! defined('BASEPATH')) {
	exit('Access Denied');
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>后台管理平台---powered by wangjian </title>
<link rel="stylesheet" type="text/css" href="<?php echo base_url() ;?><?php echo APPPATH ;?>/views/<?php echo TEMPLETE_STYLE ;?>/easyui.css">
<link rel="stylesheet" type="text/css" href="<?php echo base_url() ;?><?php echo APPPATH ;?>/views/<?php echo TEMPLETE_STYLE ;?>/admin.css">
<link rel="stylesheet" type="text/css" href="<?php echo base_url() ;?><?php echo APPPATH ;?>/views/icon.css">
<script type="text/javascript" src="<?php echo base_url() ;?><?php echo APPPATH ;?>/views/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="<?php echo base_url() ;?><?php echo APPPATH ;?>/views/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<?php echo base_url() ;?><?php echo APPPATH ;?>/views/common.js"></script>
	
</head>
<body style="margin:0px ; padding:0px;">

    <!--登录窗口-->
    
    <div id="w" class="easyui-window" title="后台管理员登录" collapsible="true" minimizable="true"
        maximizable="false" icon=""  style="width: 500px; height: 180px; padding: 8px;
        background: #fafafa;">
        <div class="easyui-layout" fit="true">
            <div region="center" border="false" style="padding: 10px; background: #fff; border: 1px solid #ccc;">
             <form id="ff" method="post" >
                <table cellpadding=3>
                    <tr>
                        <td>用户名：</td>
                        <td><input class="easyui-validatebox" type="text" name="username" data-options="required:true" validType="length[3,16]" missingMessage="管理员的姓名不能为空" invalidMessage="用户名必须在6-16位之间" style="width:200px"></input></td>
                    </tr>
                    <tr>
                        <td>密码：</td>
                        <td><input class="easyui-validatebox" type="password" name="password" data-options="required:true,validType:'password'" missingMessage="请输入正确的密码，长度在6-16位数之间" invalidMessage="请输入正确的密码，长度在6-16位数之间" style="width:200px"></td>
                    </tr>
                </table>
                 </form>
            </div>
            <div region="south" border="false" style="text-align: center; height: 30px; line-height: 24px; margin-top:4px">
             <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()" icon="icon-ok">登录</a>
           
	    	<a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">重置</a> 
				<font color="gray" style="size:12px">powered by wangjian</font>
            </div>
        </div>
        

    </div>	
   
 	<script>
		function submitForm(){
			//$.messager.progress();
			progress('正在判断数据','<font color="red">正在后台验证数据.....</font>');
			$('#ff').form('submit', {   
				url:'<?php echo site_url('admin/login/do_login') ;?>', 
				
			    onSubmit: function(){   
					var isValid = $(this).form('validate');    
					if(!isValid){
						close_progress();
					}
					return isValid ;
			    },   
			    success:function(data){  
			    	var data = $.parseJSON(data);
			    	close_progress();
			    	if(data.resultcode == 0){
			    		msgShow("系统警告",data.resultinfo.errmsg,"error");
			    		return '' ;
				    }else if(data.resultcode>0){
						window.location.href="<?php echo site_url("admin/index/frame") ;?>";
					}else{
						msgShow("系统信息",data.resultinfo.errmsg,"error");
						return ;
					}
			      
			    }   
			}); 				
		}
		function clearForm(){
			clear_form("ff");
		}
$(document).keydown(function(event){
	if(event.keyCode == 13 ){
		submitForm();
	}
});
		
</script>    	
</body>
</html>